<template>
	<view>
		<nav-bar-sub></nav-bar-sub>
		<answerSingle @submit='handleCommit' :examType="type"></answerSingle>
	</view>

</template>

<script>
	import answerSingle from '@/components/dyw-answer/answerSingle.vue';
	export default {
		data() {
			return {
				type : ''
			}
		},
		onLoad(option) {
			var that = this
			this.type = option.examType
			if (option.examType == 'error') {
				console.log('进入了1');
				if(option.template == undefined ){
					option.template = ''
				}
				if(option.queDifficulty == undefined ){
					option.queDifficulty = ''
				}
				this.$api.startErrorPrac(option.template, option.queDifficulty)
					.then(res => {
						console.log('错题练习的信息：', option.template, option.queDifficulty);
						console.log('获取错题练习列表', res);
						var APIquesList = res.values.questions
						this.$api.ModifyErrorQuesList(APIquesList)
						// console.log('获取错题练习的题目', that.$store.state.questionLis);
					})
			} else {
				console.log('进入了2');
				this.$api.startBankExercise(option.storeId, option.queType)
					.then(res => {
						console.log('题库的信息：', option.storeId, option.queType);
						console.log('进入题库', res);
						var APIquesList = res.values.questions
						this.$api.ModifyErrorQuesList(APIquesList)

						console.log('题库提取到的题目', that.$store.state.questionLis);
					})
			}
		},
		components: {
			answerSingle,
		},
		methods: {

		}
	}
</script>

<style lang="scss">
	page {
		background-color: #FFFFFF;
	}
</style>
